-- town5 - "Elerta"

function autoexec()
 if (get_progress(P_CARAVEL) == 2) then
  set_ent_chrx(HERO1, 0);
    if (get_numchrs() == 2) then
          set_ent_chrx(HERO2, 0)
    end
  set_progress(P_CARAVEL,3)
end

      
end

function refresh()
  return
end

function postexec()
end

function zone_handler(zn)
  if (zn == 1) then
    change_map("land","vil_exit");

  elseif (zn == 2) then
    warp("stor_in",8)

  elseif (zn == 3) then
    warp("stor_out",8)

  elseif (zn == 4) then
    warp("house_in",8)

  elseif (zn == 5) then
    warp("house_out",8)

  elseif (zn == 6) then
    warp("hall_in",8)

  elseif (zn == 7) then
    warp("hall_out",8)

  elseif (zn == 8) then
    warp("nursry_in",8)

  elseif (zn == 9) then
    warp("nursry_out",8)

  elseif (zn == 10) then
    if (prompt(HERO1, 2, 0, "Take a nap?",
                          "  yes",
                          "  no") == 0) then
      do_inn_effects(1)
    end
  
  elseif (zn == 11) then
    thought(HERO1,"Just a barrel of salt.");

  elseif (zn == 12) then
    thought(HERO1,"It must hold some of their supplies.");

  elseif (zn == 13) then
    touch_fire(get_pidx(0));

  elseif (zn == 14) then
    change_map("blacksmith","black_e");


  end
end

function entity_handler(en)
  if (en == 0) then
    bubble(0,"I notice that you are a magic user.");
    bubble(HERO1,"... That is true.");
    bubble(0,"Before you enter the volcano you should protect yourself with your arts. It is the only way our people can withstand the heat.");

  elseif  (en == 1) then
    bubble(en,"Ito ang ganda na pulo.");
    bubble(HERO1,"...");
    bubble(en,"Magandang araw");
    bubble(HERO1,"I don't think she knows the common tongue.");

  elseif  (en == 2) then
    if (get_progress(P_QUEST1) < 8) then
      bubble(en,"What arr you doin round here?"); 
      bubble(HERO1,"We are going to clear out the shrine up North of here.");
    else
      bubble(HERO1,"That dark mage will no longer darken this isle.");
      bubble(en,"You must a' been very brave."); 
    end

  elseif  (en == 3) then

    if (prompt(en,2,0,"Would you like to take a ride back to Grimbsy for a mere 200 gold?","  yes","  no","") == 0) then 
      if (get_gp() < 200) then
        bubble(en,"Ya trying to cheat me. Thats not enough gold.");
      elseif (get_gp() >= 200) then
        set_gp(get_gp() - 200)
        msg("You pay Captain Finch 200 gold.")
        bubble(en,"Alright let's set sail.");
        set_ent_chrx(HERO1, 34)
        if (get_numchrs() == 2) then
          set_ent_chrx(HERO2, 98)
        end
        set_progress(P_CARAVEL,4); 
	change_map("land","vilcar_exit");
         
      end 
    else
      bubble(en,"Well come back by another time.");
   end
    
  elseif  (en == 4) then
    bubble(HERO1,"What are you cooking here?");
    bubble(en,"We are not cooking. We are harvesting the sea salt."); 
    bubble(en,"We Areeams are of the sea. So when we journey on land we miss the salt.");

  elseif  (en == 5) then
    if (get_progress(P_QUEST1) < 8) then 
      bubble(HERO1,"Do you know anything about the shrine on the North side of this island?");
      bubble(en,"We do not go there. It is a tragic tale... There is a mage who lives there who has rejected all that is good and right.");
      bubble(en,"The evils he has done to his deceased former brothers is unspeakable.");
      bubble(HERO1,"We plan to rid this island from his menace."); 
      bubble(en,"May a brighter day dawn.");
    else
      bubble(en,"I thank thee for ridding Thessalia of the dark mage's evil.");
    end

  elseif  (en == 6) then
    bubble(HERO1,"Is there an Inn around here where we could lodge?");
    bubble(en,"No, we don't get many visitors. Your people usually avoid us.");
    bubble(en,"You can rest in this house if you would like.");

  elseif  (en == 7) then
    bubble(en,"This is were we keep our supplies, but I could sell you some.");
    shop(9);

end


       end 
